import React from 'react';
import { Redirect } from 'umi';
import { Toast } from 'antd-mobile';
export default (props) => {
  console.log(props.children);
  const isLogin = localStorage.getItem('hunliji_token');
  if (isLogin) {
    return <div>{props.children}</div>;
  } else {
    Toast.show({
      icon: 'fail',
      content: '请登录',
    });
    return <Redirect to={{ pathname: '/', state: { from: props.location } }} />;
  }
};
